
const JSMobileDetect = {
  isMobilePhone() {
    return this.isAndroid() || this.isIos()
  },

  isIos() {
    return this.judgeClient() === 'iOS'
  },

  isAndroid() {
    return this.judgeClient() === 'Android'
  },

  judgeClient() {
    let client = '';
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {  //判断iPhone|iPad|iPod|iOS
      client = 'iOS';
    } else if (/(Android)/i.test(navigator.userAgent)) {  //判断Android
      client = 'Android';
    } else {
      client = 'PC';
    }
    return client;
  }
}

export default JSMobileDetect;
